package model.event;

/**
 * This class represents a BidEvent. A BidEvent occurs for example if a user
 * place a bid, overbid someone with a bid or if someone wins with the highest
 * bid.
 * 
 * @version 1.0 vom 12.11.2012
 * @author Distributed Group 111 1026312, 1026309
 */

public class BidEvent extends Event {

	private static final long serialVersionUID = 1599972865064024462L;
	private String userName;
	private long auctionId;
	private double price;

	public BidEvent(EventType type, String userName, long auctionId,
			double price) {
		super(type);
		this.userName = userName;
		this.auctionId = auctionId;
		this.price = price;
	}

	public String getUserName() {
		return this.userName;
	}

	public long getAuctionId() {
		return this.auctionId;
	}

	public double getPrice() {
		return this.price;
	}

	public String toString() {
		if (EventType.BID_PLACED.equals(this.type))
			return super.toString() + "user " + this.userName + " placed bid "
					+ this.price + " on auction " + this.auctionId;
		else if (EventType.BID_OVERBID.equals(this.type))
			return super.toString() + "user " + this.userName
					+ " has been overbid with " + this.price + " on auction "
					+ this.auctionId;
		else if (EventType.BID_WON.equals(this.type))
			return super.toString() + "user " + this.userName + " won with "
					+ this.price + " the auction " + this.auctionId;
		else
			return "";
	}
}